home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / wheels1.arc / EXISTFIL.LIB < prev    next >
Text File  |  1985-06-28  |  1KB  |  31 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5. This function checks for the existence of a file of the name passed to it
  6. by attempting to reset the file with I/O error checking switched off, and
  7. then looking at IOResult, the built-in variable that holds I/O error
  8. messages.  This function will NOT check for files in any but the current
  9. directory--use the "Find_First" function in GETFILE.LIB for those.
  10.  
  11. function EXISTS: boolean;
  12.   input : a filename of a TYPE declared in user program (BEFORE including this
  13.               file!)
  14.   output: true if exists else false.
  15.  
  16. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  17.  
  18. function exists(ThisFile : old_filename_Type):boolean;
  19. var
  20.   tempFile : text;  {We can get away with assigning a text file to ANY
  21.                      filename because we aren't going to do any input/output}
  22. begin
  23.   assign(tempFile,ThisFile);
  24.   {$I-}
  25.   reset(tempFile);
  26.   {$I+}
  27.   if IOResult = 0 then exists := true
  28.     else exists := false;
  29.   close(tempFile);
  30. end;
  31.